<?xml version="1.0" encoding="UTF-8" ?>
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<script type="text/javascript">

<%-- 改变分数线--%>
function changeLineSpan(o) {
	var a=document.getElementById ("line");
	a.innerHTML = o;
}

<%-- 数量与分值联动 计算单选题分数--%>
function checkInt(o) {
	var a=document.getElementById ("singl");
	var m=document.getElementById ("totalMounts");
	var p=document.getElementById ("totalPoints");
	theV = isNaN(parseInt(o.value)) ? 0 : parseInt(o.value);
	if (theV != o.value) {
		o.value = theV;
	}
	a.innerHTML = singlesl.value * singlefz.value;
	m.innerHTML = parseInt(singlesl.value) + parseInt(multiple.value) + parseInt(pdtsl.value);
	p.innerHTML = singlesl.value * singlefz.value + multiple.value * multipfz.value + pdtsl.value * pdtfz.value;
}
function checkP(o) {
	var a=document.getElementById ("singl");
	var p=document.getElementById ("totalPoints");
	theV = isNaN(parseFloat(o.value)) ? 0 : parseFloat(o.value);
	theV = parseInt(theV * 100) / 100;
	if (theV != o.value) {
		theV = (theV * 100).toString();
		theV = theV.substring(0, theV.length - 2) + "."
				+ theV.substring(theV.length - 2, theV.length)
		o.value = theV;
	}
	
	a.innerHTML = singlesl.value * singlefz.value;
	p.innerHTML = singlesl.value * singlefz.value + multiple.value * multipfz.value + pdtsl.value * pdtfz.value;
}
<%-- 数量与分值联动 计算多选题分数--%>
function checkIntM(o) {
	var a=document.getElementById ("multip");
	var m=document.getElementById ("totalMounts");
	var p=document.getElementById ("totalPoints");
	theV = isNaN(parseInt(o.value)) ? 0 : parseInt(o.value);
	if (theV != o.value) {
		o.value = theV;
	}
	a.innerHTML = multiple.value * multipfz.value;
	m.innerHTML = parseInt(singlesl.value) + parseInt(multiple.value) + parseInt(pdtsl.value);
	p.innerHTML = singlesl.value * singlefz.value + multiple.value * multipfz.value + pdtsl.value * pdtfz.value;
}
function checkPM(o) {
	var a=document.getElementById ("multip");
	var p=document.getElementById ("totalPoints");
	theV = isNaN(parseFloat(o.value)) ? 0 : parseFloat(o.value);
	theV = parseInt(theV * 100) / 100;
	if (theV != o.value) {
		theV = (theV * 100).toString();
		theV = theV.substring(0, theV.length - 2) + "."
				+ theV.substring(theV.length - 2, theV.length)
		o.value = theV;
	}
	a.innerHTML = multiple.value * multipfz.value;
	p.innerHTML = singlesl.value * singlefz.value + multiple.value * multipfz.value + pdtsl.value * pdtfz.value;
}

<%-- 数量与分值联动 计算判断题分数--%>

function checkIntP(o) {
	var a=document.getElementById ("pd");
	var m=document.getElementById ("totalMounts");
	var p=document.getElementById ("totalPoints");
	theV = isNaN(parseInt(o.value)) ? 0 : parseInt(o.value);
	if (theV != o.value) {
		o.value = theV;
	}
	a.innerHTML = pdtsl.value * pdtfz.value;
	m.innerHTML = parseInt(singlesl.value) + parseInt(multiple.value) + parseInt(pdtsl.value);
	p.innerHTML = singlesl.value * singlefz.value + multiple.value * multipfz.value + pdtsl.value * pdtfz.value;
}
function checkPP(o) {
	var a=document.getElementById ("pd");
	var p=document.getElementById ("totalPoints");
	theV = isNaN(parseFloat(o.value)) ? 0 : parseFloat(o.value);
	theV = parseInt(theV * 100) / 100;
	if (theV != o.value) {
		theV = (theV * 100).toString();
		theV = theV.substring(0, theV.length - 2) + "."
				+ theV.substring(theV.length - 2, theV.length)
		o.value = theV;
	}
	a.innerHTML = pdtsl.value * pdtfz.value;
	p.innerHTML = singlesl.value * singlefz.value + multiple.value * multipfz.value + pdtsl.value * pdtfz.value;
}

</script>
<div class="bjui-pageContent">
	<form method="post" action="answer/tk/setPar.do" id="parForm"  class="pageForm" data-toggle="validate" data-reload-navtab="true">
		<div class="pageFormContent" data-layout-h="0">
			<table class="table table-condensed table-hover">
                <tbody>
                	<tr>
                		<td colspan="3"><label for="j_dialog_title" class="control-label x80">标题：</label>
							<input type="text" id="title" name="title" data-rule="required" size="40" />
						</td>
                	</tr>
                	<tr>
                		<td ><label for="j_dialog_starttime" class="control-label x80">开考时间：</label>
							<input type="text" id="starttime" name="starttime" data-toggle="datepicker" data-rule="required" size="12" />
						</td>
                		<td ><label for="j_dialog_endtimee" class="control-label x80">终止时间：</label>
							<input type="text" id="endtime" name="endtime" data-toggle="datepicker" data-rule="required" size="12" />
						</td>
						<td></td>
                	</tr>
					<tr>
						<td><label for="j_dialog_singlesl" class="control-label x80">单选题数量：</label>
							<input type="text" id="singlesl" name="singlesl" data-rule="digits" size="5" value="0"
							onkeyup="checkInt(this);" onpaste="checkInt(this);" oncut="checkInt(this);" ondrop="checkInt(this);" onchange="checkInt(this);"/>
						</td>
						<td><label for="j_dialog_singlefz" class="control-label x80">单选题分值：</label>
							<input type="text" id="singlefz" name="singlefz" data-rule="number" size="5" 
							onkeyup="checkP(this);" onpaste="checkP(this);" oncut="checkP(this);" ondrop="checkP(this);" onchange="checkP(this);" />
						</td>
						<td><label>单选题共&nbsp;<span id="singl" style="color: red;"></span>&nbsp;分</label></td>
						<%--<td>
							<label>单选题共
							<input id="singl" />分
							</label>
						</td>
						--%>
					</tr>
					<tr>
						<td><label for="j_dialog_multiple" class="control-label x80">多选题数量：</label>
							<input type="text" id="multiple" name="multiple" data-rule="digits" size="5"  value="0"
							onkeyup="checkIntM(this);" onpaste="checkIntM(this);" oncut="checkIntM(this);" ondrop="checkIntM(this);" onchange="checkIntM(this);"/>
						</td>
						<td><label for="j_dialog_multipfz" class="control-label x80">多选题分值：</label>
							<input type="text" id="multipfz" name="multipfz" data-rule="number" size="5" 
							onkeyup="checkPM(this);" onpaste="checkPM(this);" oncut="checkPM(this);" ondrop="checkPM(this);" onchange="checkPM(this);" />
						</td>
						<td><label>多选题共&nbsp;<span id="multip" style="color: red;"></span>&nbsp;分</label></td>
					</tr>
					<tr>
						<td><label for="j_dialog_pdtsl" class="control-label x80">判断题数量：</label>
							<input type="text" id="pdtsl" name="pdtsl" data-rule="digits" size="5" value="0"
							onkeyup="checkIntP(this);" onpaste="checkIntP(this);" oncut="checkIntP(this);" ondrop="checkIntP(this);" onchange="checkIntP(this);"/>
						</td>
						<td><label for="j_dialog_pdtfz" class="control-label x80">判断题分值：</label>
							<input type="text" id="pdtfz" name="pdtfz" data-rule="number" size="5"
							onkeyup="checkPP(this);" onpaste="checkPP(this);" oncut="checkPP(this);" ondrop="checkPP(this);" onchange="checkPP(this);" />
						</td>
						<td><label>判断题共&nbsp;<span id="pd" style="color: red;"></span>&nbsp;分</label></td>
					</tr>
					<tr>
						<td><label for="j_dialog_time" class="control-label x80">考试时长（分钟）：</label>
							<input type="text" name="time" data-rule="digits" size="5" />
						</td>
						<td><label for="j_dialog_borderline" class="control-label x80">及格分数线：</label>
							<input type="text" name="borderline" data-rule="number" size="5" onkeyup="changeLineSpan(this.value)"/>
						</td>
						<td></td>
					</tr>
					<tr>
						<td colspan="3">
							<label class="control-label x500">
								共&nbsp;<span id="totalMounts" style="color: red;"></span>&nbsp;道题，满分&nbsp;<span id="totalPoints" style="color: red;"></span>&nbsp;分，&nbsp;<span id="line" style="color: red;"></span>&nbsp;分及格
							</label>
						</td>
					</tr>
				</tbody>
            </table>
		</div>
		 <div class="bjui-footBar">
            <ul>
                <li><button type="button" class="btn-close">关闭</button></li>
                <li><button type="submit" class="btn-default">发起考试</button></li>
            </ul>
        </div>
	</form>
</div>